﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShopREG.aspx.cs" Inherits="sWarranty.WEB.ShopREG" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="../UC/Header.ascx" TagName="Header" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../CSS/table.css" />
    <link rel="stylesheet" type="text/css" href="../CSS/Menu.css" />
    <script src="../JS/jquery-1.8.2.js" type="text/javascript"></script>
    <script src="../JS/notify.js" type="text/javascript"></script>
    <link href="../CSS/notify.css" rel="stylesheet" type="text/css" />
    <link href="../JS/chosen-master/chosen/chosen.css" rel="stylesheet" type="text/css" />
    <script src="../JS/chosen-master/chosen/chosen.jquery.js" type="text/javascript"></script>
    <style>
        #dropBillTo option
        {
            width: 100%;
        }
        .watermarked
        {
            background-color: #F0F8FF;
            color: gray;
            padding: 2px 0 0 2px;
        }
        .chzn-select {
            margin-left: 0px;
        }
        .auto-style1 {
            height: 37px;
        }
        .auto-style2 {
            padding: 7px 17px 7px 17px;
            font-weight: bold;
            border-bottom: 1px dashed #cd698b;
            background-color: #F7F7F7;
            height: 37px;
            width: 189px;
        }
        .auto-style3 {
            padding: 7px 17px 7px 17px;
            font-weight: bold;
            border-bottom: 1px dashed #cd698b;
            background-color: #F7F7F7;
            width: 189px;
        }
        .auto-style4 {
            width: 189px;
        }
    </style>
    <script>
        //        window.onunload = refreshParent;
        //        function refreshParent() {
        //            var loc = window.opener.location;
        //            window.opener.location = loc;
        //            //window.opener.location.reload();
        //        }

    </script>
    <script type='text/javascript'>
        function openPopUp(popUrl, type) {
            window.open(popUrl);
            return;
            var name = 'popUp';
            var appearence = 'dependent=no,menubar=no,resizable=yes,scrollbars=1,' +
                  'status=yes,toolbar=yes,titlebar=yes,' +
                  'width=' + window.screen.availWidth * 80 / 100 + ', height=' + window.screen.availHeight * 80 / 100 + ',resizable=yes,center=yes';
            var openWindow = '';
            if (type == 'open') {
                openWindow = window.open(popUrl, name, appearence);
                //openWindow.focus();
            }
            if (type == 'popup') {
                alert('2');
                openWindow = window.showModalDialog(popUrl, name, appearence);
                //openWindow.focus();
            }
        }

        function endsWith(str, suffix) {
            return str.indexOf(suffix, str.length - suffix.length) !== -1;
        }

        $(document).ready(function () {
            checkFirstVisit();

            //            $('#txtCell1').blur(function () {
            //                var value = $('#txtCell1').val();
            //                if (value.startsWith('09') || value.startsWith('01')) {
            //                    value = value.substr(1, value.length);
            //                    value = "+84" + value;
            //                    document.getElementById('txtCell1').value = value;
            //                }
            //            });

        });
        function checkFirstVisit() {
            if (document.cookie.indexOf('mycookie') == -1) {
                // cookie doesn't exist, create it now
                document.cookie = 'mycookie=1';
                //$('#lblBillTo').text('-- Select --');
                //$('#lblCusCode').text('-- Select Bill Code first --');

            }
            else {
                // not first visit, so alert
                //alert('You refreshed!');
                var billto = $('#txtBillTo2').val();
                var billName = $('#txtBillToName2').val();
                //var cusCode = $('#txtCusCode2').val();
                //var cusAdd = $('#txtCusAddress2').val();

                var province = $('#txtProvince3').val();
                var district = $('#txtDistrict3').val();

                document.getElementById('txtBillCode').value = billto
                //document.getElementById('txtBillName').value = billName
                //document.getElementById('txtCusCode').value = cusCode
                //document.getElementById('txtCusAddress').value = cusAdd
                document.getElementById('txtProvince').value = province;
                document.getElementById('txtDistrict').value = district;

                //                for (var i = document.getElementById('dropBillTo').options.length - 1; i >= 0; i--) {
                //                    if (document.getElementById('dropBillTo').options[i].value == billto) {
                //                        document.getElementById('dropBillTo').selectedIndex = i;
                //                    }
                //                }
            }
        }
       
    </script>
    <script type="text/javascript">
        function showConfirmation() {
            document.getElementById('Label1').innerText = 'upload complete.';
        }  
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:Label ID="Label1" runat="server"></asp:Label>
    <asp:ScriptManager ID="ksdjfl" runat="server">
    </asp:ScriptManager>
    <div style="display: none;">
        <asp:Label ID="lblShopCode" runat="server"></asp:Label>
        <asp:TextBox ID="txtBillTo2" ClientIDMode="Static" runat="server"></asp:TextBox>
        <asp:TextBox ID='txtBillCodeHidden' runat="server"></asp:TextBox>
        <asp:TextBox ID="txtBillToName2" ClientIDMode="Static" runat="server"></asp:TextBox>
        <%--<asp:TextBox ID="txtCusAddress2" ClientIDMode="Static" runat="server"></asp:TextBox>
        <asp:TextBox ID="txtCusCode2" ClientIDMode="Static" runat="server"></asp:TextBox>--%>
        <asp:TextBox ID="txtFileName" ClientIDMode="Static" runat="server"></asp:TextBox>
        <asp:TextBox ID="txtProvince2" ClientIDMode="Static" runat="server"></asp:TextBox>
        <% //value %>
        <asp:TextBox ID="txtDistrict2" ClientIDMode="Static" runat="server"></asp:TextBox>
        <% //value %>
        <asp:TextBox ID="txtProvince3" ClientIDMode="Static" runat="server"></asp:TextBox>
        <% //hien thi %>
        <asp:TextBox ID="txtDistrict3" ClientIDMode="Static" runat="server"></asp:TextBox>
        <% //hien thi %>
    </div>
    <div class="Mid">
        <div class="Mid1">
            <div id="DataContent">
                <%-- <div>
                    Nội dung bên trái
                </div>--%>
                <div>
                    <div class="TitleCont">
                        <asp:Label ID="lblTitle" runat="server" Text="Register New Shop"></asp:Label>
                    </div>
                    <!-- DataGrid Start -->
                    <div class="Mid2">
                        <div class="Search2">
                            <table id="newspaper-b">
                                <tbody>
                                    <tr>
                                        <td class="BackGround-gray">
                                            Bill to<span style="color: Red;">*</span>
                                        </td>
                                        <td>
                                            <asp:TextBox ID='txtBillCode' runat="server" ClientIDMode="Static" Enabled='false'
                                                Width="77%"></asp:TextBox>
                                            <asp:Button ID="btnFindBill" runat="server" CssClass="button" Text="..." Width="10%" />
                                        </td>
                                        <td class="auto-style3">
                                            Region
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="dropArea" runat="server" Width="80%" CssClass="chzn-select">
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="BackGround-gray">
                                            Name<span style="color: Red;">*</span>
                                        </td>
                                        <td>
                                            <%--<asp:TextBox ID='txtBillName' runat="server" ClientIDMode="Static" Width="57%" Enabled='false'></asp:TextBox>--%>
                                            <asp:TextBox ID='txtName' runat="server" Width="80%"></asp:TextBox>
                                        </td>
                                        <td class="auto-style3">
                                            Owner Name
                                        </td>
                                        <td>
                                            <asp:TextBox ID='txtOwnerName' runat="server" Width="80%"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="BackGround-gray">
                                            Address<span style="color: Red;">*</span>
                                        </td>
                                        <td>
                                            <%--<asp:TextBox ID='txtCusAddress' runat="server" ClientIDMode="Static" Width="57%" Enabled='false'></asp:TextBox>--%>
                                            <asp:TextBox ID='txtAddress' runat="server" Width="80%"></asp:TextBox>
                                        </td>
                                        <td class="auto-style3">
                                            Owner Email
                                        </td>
                                        <td>
                                            <asp:TextBox ID='txtOwnerEmail' runat="server" Width="80%"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="BackGround-gray">
                                            Cell No 1<span style="color: Red;">*</span>
                                            <asp:TextBoxWatermarkExtender ID="TBWE2" runat="server" TargetControlID="txtCell1"
                                                WatermarkText="09xxx or 01xxx" WatermarkCssClass="watermarked" />
                                        </td>
                                        <td>
                                            <asp:TextBox ID='txtCell1' runat="server" Width="80%"></asp:TextBox>
                                            <asp:TextBox ID='txtCell1Hidden' runat="server" Width="80%" Visible="false"></asp:TextBox>
                                        </td>
                                        <td class="auto-style3">
                                            Cell No 2
                                        </td>
                                        <td>
                                            <asp:TextBox ID='txtCell2' runat="server" Width="80%"></asp:TextBox>
                                            <asp:TextBox ID='txtCell2Hidden' runat="server" Width="80%" Visible="false"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="BackGround-gray" rowspan="2">
                                            Location<span style="color: Red;">*</span>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtProvince" runat="server" Enabled='false' Width="80%"></asp:TextBox>
                                            <asp:Button ID="btnFindProvince" runat="server" CssClass="button" Text="..." Width="10%" />
                                        </td>
                                        <td class="auto-style3">
                                            ISDN No
                                        </td>
                                        <td>
                                            <asp:TextBox ID='txtISDN' runat="server" Width="80%"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="auto-style1">
                                            <asp:TextBox ID="txtDistrict" runat="server" Enabled='false' Width="80%"></asp:TextBox>
                                        </td>
                                        <td class="auto-style2">
                                            Local Marketer
                                        </td>
                                        <td class="auto-style1">
                                            <asp:TextBox ID='txtLocalMkt' runat="server" Width="80%"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="BackGround-gray">
                                            Type/Channel
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="dropShopType" runat="server" Width="50%" CssClass="chzn-select">
                                                 <asp:ListItem Value="SUB-D" Text="Sub Dealer"></asp:ListItem>
                                                <asp:ListItem Value="MC" Text="Modern Channel"></asp:ListItem>
                                                <asp:ListItem Value="DSP" Text="Direct Sale Point"></asp:ListItem>
                                                <asp:ListItem Value="WS" Text="Whole Sale"></asp:ListItem>
                                            </asp:DropDownList>
                                            <asp:DropDownList ID="dropChannel" runat="server" Width="50%" CssClass="chzn-select">
                                                <asp:ListItem Value="Y" Text="Direct"></asp:ListItem>
                                                <asp:ListItem Value="N" Text="In-Direct"></asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                        <td class="auto-style2">
                                            Use flag
                                            </td>
                                        <td>
                                            <asp:CheckBox ID="chkEnable" runat="server" Text="Yes" Visible="True" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="BackGround-gray" colspan="4">
                                            <asp:Button ID="btnSave" runat="server" CssClass="button Float-right" Text="Save"
                                                Width="80px" OnClick="btnSave_Click" />
                                            <input type='button' value="Close" style="width: 80px;" class="button Float-right"
                                                onclick="javascript:window.close();" />
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <!-- DataGrid End -->
                        </div>
                    </div>
                    <div class="Clear_both">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(".chzn-select").chosen();
    </script>
    </form>
</body>
</html>
